package paritclecontainer2d;

public class ToggleEmiter extends SimpleEmiter {

	private static final int DEFAULT_PARTICAL_AMOUNT = 1;
	
	protected Particle activeParticle;
	protected boolean isActive;
	
	protected int amount;
	protected int emiterX;
	protected int emiterY;
	
	public ToggleEmiter(int decay, int speed){
		super(decay, speed);
		this.amount = DEFAULT_PARTICAL_AMOUNT;
	}
	

	@Override
	public void refreshParticles() {
		if(isActive){
			createParticle();
		}
		super.refreshParticles();
	}

	protected void createParticle(){
		if(activeParticle != null){
			spawnParticle(activeParticle, amount, emiterX, emiterY);
		}

	}

	public boolean isActive() {
		return isActive;
	}

	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public int getEmiterX() {
		return emiterX;
	}

	public void setEmiterX(int emiterX) {
		this.emiterX = emiterX;
	}

	public int getEmiterY() {
		return emiterY;
	}

	public void setEmiterY(int emiterY) {
		this.emiterY = emiterY;
	}


	public void setParticle(Particle particle) {
		this.activeParticle = particle;
	}

	
}
